home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 May / may_2001.iso / intercd / root / Multimedia / ^DivX_Article / virtualdub / VirtualDub-source-1_4d / a_scene.asm < prev    next >
Encoding:
Assembly Source File  |  2001-03-20  |  3.6 KB  |  214 lines

  1. ;    VirtualDub - Video processing and capture application
  2. ;    Copyright (C) 1998-2001 Avery Lee
  3. ;
  4. ;    This program is free software; you can redistribute it and/or modify
  5. ;    it under the terms of the GNU General Public License as published by
  6. ;    the Free Software Foundation; either version 2 of the License, or
  7. ;    (at your option) any later version.
  8. ;
  9. ;    This program is distributed in the hope that it will be useful,
  10. ;    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ;    GNU General Public License for more details.
  13. ;
  14. ;    You should have received a copy of the GNU General Public License
  15. ;    along with this program; if not, write to the Free Software
  16. ;    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18.     .386
  19.     .model    flat
  20.     .code
  21.  
  22.     public    _asm_scene_lumtile32
  23.     public    _asm_scene_lumtile24
  24.     public    _asm_scene_lumtile16
  25.  
  26. ;asm_scene_lumtile32(src, width, height, modulo, gtotalptr);
  27.  
  28. _asm_scene_lumtile32:
  29.     push    ebx
  30.     push    ecx
  31.     push    edx
  32.     push    esi
  33.     push    edi
  34.     push    ebp
  35.     mov    esi,[esp+4+24]
  36.     mov    edi,[esp+12+24]
  37.     xor    eax,eax
  38.     xor    ebx,ebx
  39. asm_scene_lumtile32_row:
  40.     mov    ebp,[esp+8+24]
  41. asm_scene_lumtile32_col:
  42.     mov    ecx,[esi + ebp*4 - 4]
  43.     mov    edx,0000ff00h
  44.     and    edx,ecx
  45.     and    ecx,00ff00ffh
  46.     add    eax,ecx
  47.     add    ebx,edx
  48.     dec    ebp
  49.     jne    asm_scene_lumtile32_col
  50.     add    esi,[esp+16+24]
  51.     dec    edi
  52.     jne    asm_scene_lumtile32_row
  53.  
  54.     add    eax,00200020h
  55.     add    ebx,00002000h
  56.     shr    eax,6
  57.     and    ebx,003fc000h
  58.     shr    ebx,6
  59.     and    eax,00ff00ffh
  60.     add    eax,ebx
  61.  
  62.     pop    ebp
  63.     pop    edi
  64.     pop    esi
  65.     pop    edx
  66.     pop    ecx
  67.     pop    ebx
  68.     ret
  69.  
  70. ;asm_scene_lumtile24(src, width, height, modulo, btotalptr);
  71.  
  72. _asm_scene_lumtile24:
  73.     push    ebx
  74.     push    ecx
  75.     push    edx
  76.     push    esi
  77.     push    edi
  78.     push    ebp
  79.     mov    esi,[esp+4+24]
  80.     mov    edi,[esp+12+24]
  81.     xor    eax,eax
  82.     xor    ebx,ebx
  83. asm_scene_lumtile24_row:
  84.     mov    ebp,[esp+8+24]
  85.     push    esi
  86. asm_scene_lumtile24_col:
  87.     mov    ecx,[esi]
  88.     mov    edx,0000ff00h
  89.     and    edx,ecx
  90.     and    ecx,00ff00ffh
  91.     add    eax,ecx
  92.     add    ebx,edx
  93.     add    esi,3
  94.     dec    ebp
  95.     jne    asm_scene_lumtile24_col
  96.     pop    esi
  97.     add    esi,[esp+16+24]
  98.     dec    edi
  99.     jne    asm_scene_lumtile24_row
  100.  
  101.     add    eax,00200020h
  102.     add    ebx,00002000h
  103.     shr    eax,6
  104.     and    ebx,003fc000h
  105.     shr    ebx,6
  106.     and    eax,00ff00ffh
  107.     add    eax,ebx
  108.  
  109.     pop    ebp
  110.     pop    edi
  111.     pop    esi
  112.     pop    edx
  113.     pop    ecx
  114.     pop    ebx
  115.     ret
  116.  
  117.  
  118. ;asm_scene_lumtile16(src, width, height, modulo, btotalptr);
  119.  
  120. _asm_scene_lumtile16:
  121.     push    ebx
  122.     push    ecx
  123.     push    edx
  124.     push    esi
  125.     push    edi
  126.     push    ebp
  127.     sub    esp,8
  128.     mov    esi,[esp+4+32]
  129.     mov    edi,[esp+12+32]
  130.     xor    eax,eax
  131.     xor    ebx,ebx
  132. asm_scene_lumtile16_row:
  133.     mov    ebp,[esp+8+32]
  134. asm_scene_lumtile16_col:
  135.     mov    ecx,[esi + ebp*2 - 4]
  136.     mov    edx,03e07c1fh
  137.     and    edx,ecx
  138.     and    ecx,7c1f03e0h
  139.     shr    ecx,5
  140.     add    ebx,edx
  141.     add    eax,ecx
  142.     add    esi,4
  143.     sub    ebp,2
  144.     ja    asm_scene_lumtile16_col
  145.  
  146.     ;    3322222222221111111111
  147.     ;    10987654321098765432109876543210
  148.     ;eax    <--- g ---><--- r ---><---b --->
  149.     ;ebx    <--- r ---><---b ---><--- g --->
  150.  
  151.     mov    ecx,eax
  152.     mov    edx,ebx
  153.  
  154.     shr    edx,11
  155.     and    ecx,000001ffh
  156.  
  157.     and    edx,000001ffh
  158.     mov    ebp,eax
  159.  
  160.     shl    ebp,6
  161.     add    ecx,edx
  162.  
  163.     mov    edx,ebx
  164.     and    ebp,07ff0000h
  165.  
  166.     shr    edx,5
  167.     add    ecx,ebp
  168.  
  169.     add    ecx,edx
  170.     mov    ebp,eax
  171.  
  172.     shl    ebx,8
  173.     and    eax,0ffe0000h
  174.  
  175.     shr    eax,9
  176.     and    ebx,0007ff00h
  177.  
  178.     add    eax,ebx
  179.     add    esi,[esp+16+32]
  180.  
  181.     mov    ecx,[esp]
  182.     mov    edx,[esp+4]
  183.  
  184.     add    ecx,ebp        ;red/blue
  185.     add    edx,eax        ;green
  186.  
  187.     mov    [esp],ecx
  188.     mov    [esp+4],edx
  189.  
  190.     dec    edi
  191.     jne    asm_scene_lumtile16_row
  192.  
  193.     mov    eax,[esp]
  194.     mov    ebx,[esp+4]
  195.  
  196.     add    eax,00200020h
  197.     add    ebx,00002000h
  198.     shr    eax,6
  199.     and    ebx,003fc000h
  200.     shr    ebx,6
  201.     and    eax,00ff00ffh
  202.     add    eax,ebx
  203.  
  204.     add    esp,8
  205.     pop    ebp
  206.     pop    edi
  207.     pop    esi
  208.     pop    edx
  209.     pop    ecx
  210.     pop    ebx
  211.     ret
  212.  
  213.     end
  214.